<html>
<head>
	<title>Tutorial: Adding gates</title>
</head>
<body bgcolor="FFFFFF">

<p><b>Next:</b> <a href="tutor-wires.html">Step 2: Adding wires</a></p>

<h2>Step 1: Adding gates</h2>

<p>Recall that we're trying to build the following circuit in Logisim.</p>
<center><img width="323" height="147" src="xor-circ.png" /></center>

<p>I suggest building a circuit by inserting the gates first as a sort of
skeleton and then connecting them with wires later. The first thing we'll do
is to add the two AND gates. Click on the AND tool in the toolbar
(<img width="16" height="16" src="../../icons/andGate.gif" />, the
next-to-last tool listed).
Then click in the editing area where
you want the first AND gate to go. Be sure to leave plenty of room
for stuff on the left. Then click the AND tool again and place the second
AND gate below it.</p>
<center><img width="473" height="247" src="shot-ands.png" /></center>
<p>Notice the five dots on the left side of the AND gate. These are spots
where wires can be attached. It happens that we'll just use two of them
for our XOR circuit; but for other circuits, you may find that having
more than two wires going to an AND gate is useful.</p>

<p>Now add the other gates.  First click on the OR tool
(<img width="16" height="16" src="../../icons/orGate.gif" />);
then click where you want it. And place the two NOT gates into the canvas
using the NOT tool
(<img width="16" height="16" src="../../icons/notGate.gif" />).</p>
<center><img width="473" height="247" src="shot-gates.png" /></center>
<p>I left a little space between the NOT gates and the AND gates; if you
want to, though, you can put them up against each other and save
yourself the effort of connecting them with a wire later.</p>

<p>Now we want to add the two inputs <var>x</var> and <var>y</var> into
the diagram. Select the Input tool
(<img width="16" height="16" src="../../icons/pinInput.gif" />),
and place the pins down.
You should also place an output pin next to the OR gate's output using
the Output tool
(<img width="16" height="16" src="../../icons/pinOutputReversed.gif" />).
(Again, I'm leaving a bit of space between the OR gate and the output
pin, but you might choose to place them right next to each other.)</p>
<center><img width="473" height="247" src="shot-comps.png" /></center>

<p>If you decide you don't like where you placed something, then you can
select it using the Edit tool
(<img width="16" height="16" src="../../icons/select.gif" />)
and drag it to the desired spot. Or you can delete it altogether by selecting
Delete from the Edit menu or pressing the Delete key.</p>

<p>As you place each component of the circuit, you'll notice that as soon as
the component is placed, Logisim reverts to the Edit tool so that you can
move the recently-placed component or (as we'll see soon) connect the component
to others by creating wires. If you want to add a copy of the recently placed
component, a shortcut is to press Control-D to duplicate the selection.
(Some computers use another keys for menus, such as the Command key on
Macintoshes. You would press that key with the D key.)</p>

<p><b>Next:</b> <a href="tutor-wires.html">Step 2: Adding wires</a></p>

</body>
</html>
